package cn.bugstack.test.service;

import cn.bugstack.domain.req.ShopCartReq;
import cn.bugstack.domain.res.PayOrderRes;
import cn.bugstack.service.IOrderService;
import com.alibaba.fastjson2.JSON;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author Yuhuan
 * @description
 * @date 2025/8/7 下午6:30
 */

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderServiceTest {

    @Resource
    private IOrderService orderService;

    @Test
    public void test_createOrder() throws Exception {
        ShopCartReq shopCartReq = new ShopCartReq();
        shopCartReq.setUserId("123");
        shopCartReq.setProductId("1001");
        PayOrderRes payOrderRes = orderService.createOrder(shopCartReq);
        log.info("请求参数：{}", JSON.toJSON(shopCartReq));
        log.info("测试结果：{}", JSON.toJSON(payOrderRes));
    }
}
